<?php
class cadastroController
{
	public function index()
	{
?>
		<div class="center_title_bar">Cadastre-se</div>
		<div class="prod_box_big">
			<div class="center_prod_box_big">
				<div class="contact_form">
					<form name="cadastro" id="FrmCadastro" action="?controller=cadastro&action=cadastra" method="POST" enctype="application/x-www-form-urlencoded">
						<div class="form_row">
			            	<label class="contact"><strong>Login:</strong></label><input type="text" name="login" id="login" value="" minlength="5" maxlength="15" class="contact_input">
						</div>

						<div class="form_row">
			            	<label class="contact"><strong>Senha:</strong></label><input type="password" name="password" id="password" value="" minlength="6" maxlength="15" class="contact_input">
						</div>

						<div class="form_row">
			            	<label class="contact"><strong>Confirmar senha:</strong></label><input type="password" name="confirm_password" id="confirm_password" value="" minlength="6" maxlength="15" class="contact_input">
						</div>

						<div class="form_row">
							<label class="contact"><strong>E-Mail:</strong></label><input type="text" name="email" id="email" value="" class="contact_input">
						</div>

						<div class="form_row" style="text-align: left !important;">
			            	<label class="contact"><strong>Sexo:</strong></label>Masculino<input type="radio" name="sexo" value="M" class="contact_input" checked="checked">&nbsp;Feminino<input type="radio" name="sexo" value="F" class="contact_input">
						</div>

			            <div class="form_row">
							<input type="submit" name="btnEnvia" value="Enviar" class="submit_form">
			            </div>
					</form>
				</div>
			</div>
		</div>
<?php
	} // Fecha function index()
	
	public function cadastra()
	{
		$database = new BD();
		
		$cadastro = "INSERT INTO account VALUES(NULL,'" . $_POST['login'] . "', '" . $_POST['senha'] . "',";
		$cadastro .= "'" . $_POST['email'] . "', '" . $_POST['sexo'] . "', NOW(), '" . $_SERVER['REMOTE_ADDR'] . "',";
		$cadastro .= "NOW(), '" . $_SERVER['REMOTE_ADDR'] . "');";
		
		$database->query($cadastro);
		
		die();
?>
		
<?php
	}
}